#include "MoveLever.h"


MoveLever::MoveLever() {
	// Use requires() here to declare subsystem dependencies
	// eg. requires(chassis);
	Requires(lever);
	spike = lever->getRelay();
	state = 0;
}

MoveLever::MoveLever(int direction)
{
	MoveLever::MoveLever();
	state = direction;
	
	
}

// Called just before this Command runs the first time
void MoveLever::Initialize() {
	
}

// Called repeatedly when this Command is scheduled to run
void MoveLever::Execute() {
	switch(state){
		case 1:
			spike->Set(Relay::kForward);
		case -1:
			spike->Set(Relay::kReverse);
		default:
			spike->Set(Relay::kOff);
		}
	
}

// Make this return true when this Command no longer needs to run execute()
bool MoveLever::IsFinished() {
	return false;
}

// Called once after isFinished returns true
void MoveLever::End() {
	
}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
void MoveLever::Interrupted() {
	spike->Set(Relay::kOff);
}
